<?php
define('APPGROUPUSERS','1.00');
/************************************************************************/
/* FrameWork  test preview                                              */
/* ==================================================================== */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
//carica la lingua se esiste
$lang=lang();
if (file_exists("applications/$appname/lang/$lang.inc"))
    include "applications/$appname/lang/$lang.inc";
else
    include "applications/$appname/lang/it.inc";
?>
	<?php if (admin_isadmin()){
	    admin_writelog("admin:modify group-users");
	    //echo "appname=$appname<br/>";
	?>
        <h3><?=_GROUPS;?></h3><hr />
	<div id="groups" >
	<div id="group-users"  >

	    <form name='sel_user' action='index.php'>
		<input type='hidden' name='appname' value='<?=$appname?>' />
		<input type='hidden' name='op' value='group-users' />
		<?php $user=$_GET['user'];?>
		<b><?=_SEL_USER;?></b> <select name='user' style="width:50%">
		    <option><?=$user ?></option>
		    <?php
			$listusers=user_listusers();
			foreach( $listusers as $seluser){
			    if($seluser!=$user)
				echo("<option>$seluser</option>\n");
			}
		    ?>
		</select>
		<input type='submit' value='<?=_GO;?>' />
	    </form>
	    <hr />

	    <table border=1 width="100%">
		<tr>
		    <td width="50%">
			<form name='remove_user' action='index.php'>
			    <input type='hidden' name='appname' value='<?=$appname?>' />
			    <input type='hidden' name='group_op' value='removeuser' />
			    <input type='hidden' name='user' value=<?=$user ?> />
			    <input type='hidden' name='op' value='group-users' />
			    <select name='group' size='5' style="width:100%; border-color:0;">
				<?php
				    $listgroupsel=@file("datas/sb/".sb_get()."/group/users/$user");
				    foreach( $listgroupsel as $groupsel){
					echo("<option>$groupsel</option>\n");
				    }
				?>
			    </select>
			    <br />
			    <br />
			    <center><input type='submit' value='<?=_DEL_USER;?>' /></center>
			</form>
		    </td>
		    <td width="50%">
			<form name='add_user' action='index.php' >
			    <input type='hidden' name='appname' value='<?=$appname?>' />
			    <input type='hidden' name='group_op' value='adduser' />
			    <input type='hidden' name='user' value=<?=$user ?> />
			    <input type='hidden' name='op' value='group-users' />
			    <select name='group' size='5' style="width:100%; border-color:0;" >
				<?php
				    $listgroups=group_listgroups();
				    foreach( $listgroups as $groupsel){
					if(!in_array($groupsel."\n",$listgroupsel))
					    echo("<option>$groupsel</option>\n");
				    }
				?>
			    </select>
			    <br />
			    <br />
			    <center><input type='submit' value='<?=_ADD_USER;?>' /></center>
			</form>
		    </td>
		</tr>
	    </table>
	</div>
	<?php  } ?>
